﻿using Tdv.Wfrp.CharacterGenerator.Client.ViewModels.Interfaces;
using Tdv.Wfrp.CharacterGenerator.Client.Views.Implementations;
using System.Windows.Controls;
using Tdv.Wfrp.CharacterGenerator.Services.Interfaces.Navigation;

namespace Tdv.Wfrp.CharacterGenerator.Client.Services.Implementation
{
    public class NavigationService : INavigationService
    {
        #region INavigationService Members

        public void Navigate(NavigationTarget target)
        {
            IMainViewModel mainViewModel = ServiceProvider.GetService<IMainViewModel>();
            UserControl userControl = null;
            IViewModelBase viewModel = null;
            switch (target)
            {
                case NavigationTarget.CharacteristicView:
                    userControl = ServiceProvider.GetService<CharacteristicView>();
                    viewModel = ServiceProvider.GetService<ICharacteristicViewModel>();
                    break;
            }

            userControl.DataContext = viewModel;
            mainViewModel.DisplayedView = userControl;
        }

        #endregion
    }
}
